package com.atlassianstudio.confluence.htmldiff.actions;

import com.atlassianstudio.confluence.htmldiff.Util;

public class DiffPagesAction extends com.atlassian.confluence.pages.actions.DiffPagesAction {
    public void setHtml(boolean html) {
        this.html = html;
    }

    public boolean getHtml() {
        return this.html;
    }

    public String getDiff() {
        if (this.html) {
            try {
                return Util.diffHTML(wikiStyleRenderer.convertWikiToXHtml(getOriginalPage().toPageContext(), getOriginalPage().getContent()), wikiStyleRenderer.convertWikiToXHtml(getRevisedPage().toPageContext(), getRevisedPage().getContent()));
            } catch (Exception e) {
//                e.printStackTrace();
                return super.getDiff();
            }
        } else {
            return super.getDiff();
        }
    }


    public String getHtmlchange0() {
        return htmlchange0;
    }

    private String htmlchange0;
    private boolean html = false;

}